package leetcode.code0104;

import leetcode.helper.HelpDebug;
import leetcode.helper.tree.TreeArray;
import leetcode.helper.tree.TreeNode;

public class Solution104 {

	public int maxDepth(TreeNode root) {
		if (root == null)
			return 0;
		return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
	}

	public static void main(String[] args) {
		Solution104 so = new Solution104();
		String s = "[3,9,20,null,null,15,7]";
		TreeNode root = TreeArray.array2tree(HelpDebug.str2array4(s));
		int e = 3;
		int r = so.maxDepth(root);
		HelpDebug.compare(e, r);
	}

}
